Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

456
Vistas
Why do I have an error "default.initializeApp(...).auth is not a function" using firebase?

So I'm creating a react app using firebase and my firebase.js file looks like this:

import firebase from 'firebase/compat/app';
import "firebase/auth";
export const auth = firebase.initializeApp({
    apiKey: "{my_key}",
    authDomain: "{domain}",
    projectId: "{project_id}",
    storageBucket: "{storage}",
    messagingSenderId: "{sender_id}",
    appId: "{app_id}",
    measurementId: "{blablabla}"
  }).auth();

And my Login.jsx:

import firebase from 'firebase/compat/app';

import { auth } from '../firebase';

<Button onClick={() => auth.signInWithRedirect(new firebase.auth.GoogleAuthProvider())}>

I want to sign in through google, as you can see, so I import auth from firebase.js, but when I do npm start I have the next error in console:

Uncaught TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_0__.default.initializeApp(...).auth is not a function

I'm not sure why it says that auth is not a function.

Edit: I also tried to import with require('firebase/auth') but it didn't help.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda